<template>
  <div>
    <van-nav-bar   fixed=true  placeholder=true title="我未出租的" left-text="返回" left-arrow @click-left="onClickLeft" />
    <van-card v-for="(detailItem, index) in tableData" :key="index" :price="detailItem.price" :title="detailItem.title"
      :desc="detailItem.description" :thumb="detailItem.imageUrls[0]" @click="toDetails(detailItem.id)">
    </van-card>
    <div style="height:200px"></div>
  </div>
</template>

<script>
export default {
  name: 'ProductPage',
  data() {
    return {
      tableData: [
        {
          id: 0,
          title: "",
          description: "",
          price: 0,
          guarentee: 0,
          createrId: 0,
          imageUrls: []
        },],
    };
  },
  components: {
  },
  created() {
    //发送get
    this.axios({
      method: "GET",
      url: "/aapi/mygoods"
    }).then(response => {
      console.log(response);
      this.tableData = response.data.myProducts
    })
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1)

    },
    toDetails(id) {
      console.log(id)
      this.$store.commit("changeproductid", id)
      this.$router.push({
        path: '/goodsdetail'
      })
    },
  }
}
</script>